package me.chyxion.jdbc.util;

import java.util.Collection;

/**
 * @version 0.0.1
 * @since 0.0.1
 * @author Shaun Chyxion
 */
public class StringUtils {

	public static String join(final Collection<? extends CharSequence> args, final String separator) {
        return String.join(separator, args);
    }

	/**
	 * @param str string
	 * @param searchStr search string
	 * @return search string index
	 */
    public static int indexOfIgnoreCase(String str, String searchStr) {
    	int indexNotFound = -1;
        if (str == null || searchStr == null) {
            return indexNotFound;
        }
        int startPos = 0;
        int endLimit = str.length() - searchStr.length() + 1;
        if (startPos > endLimit) {
            return indexNotFound;
        }
        if (searchStr.length() == 0) {
            return startPos;
        }
        for (int i = startPos; i < endLimit; i++) {
            if (str.regionMatches(true, i, searchStr, 0, searchStr.length())) {
                return i;
            }
        }
        return indexNotFound;
    }
}
